<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Album
 * @copyright  Copyright 2006-2010 Webligo Developments
 * @license    http://www.socialengine.net/license/
 * @version    $Id: AdminSettingsController.php 9339 2011-09-29 23:03:01Z john $
 * @author     Jung
 */

/**
 * @category   Application_Extensions
 * @package    Album
 * @copyright  Copyright 2006-2010 Webligo Developments
 * @license    http://www.socialengine.net/license/
 */
class Visits_AdminSettingsController extends Core_Controller_Action_Admin
{
  public function indexAction()
  {
      
    // Make navigation
    $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')
      ->getNavigation('visits_admin_main', array(), 'visits_admin_main_settings');

    $settings = Engine_Api::_()->getApi('settings', 'core');
      
    $this->view->form = $form = new Visits_Form_Admin_Global();
    $form->visits_page->setValue($settings->getSetting('visits.page', 9));
    $form->visits_notifications->setValue($settings->getSetting('visits.notifications', 1));
    if( $this->getRequest()->isPost()&& $form->isValid($this->getRequest()->getPost()))
    {
      $values = $form->getValues();
       foreach ($values as $key => $value){
        Engine_Api::_()->getApi('settings', 'core')->setSetting($key, $value);
      }
      $form->addNotice('Your changes have been saved.');
    }
  
  }
}
